/*
 * @authors :Bin Mei
 * @date    :2017-08-09
 * @description：票交汇App - Account- 账户首页
 */
import {ACCOUNT_HOME} from "../../actions/Account/index";

let initStates = {
	account:{}
};
function accountIndex(state = initStates,action){
	switch(action.type){

		case ACCOUNT_HOME:
			//获取数据
			let {list} = action.data.totalInvestment;
			if(list&&list.length>0){
				list.sort((a,b)=>{
	       var x = a.projectType;
	       var y = b.projectType;
	       return x<y? -1 : x> y? 1 : 0;
	      });
			}
			return Object.assign({},state,{account:action.data});
		
		default:
			return state;
	};
};

export default accountIndex;


